-
Notifications
You must be signed in to change notification settings - Fork 619
Fix join precedence for non-snowflake queries #1905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix @Dimchikkk! Left a couple comments
src/parser/mod.rs
Outdated
@@ -12486,7 +12486,7 @@ impl<'a> Parser<'a> { | |||
}; | |||
let mut relation = self.parse_table_factor()?; | |||
|
|||
if self.peek_parens_less_nested_join() { | |||
if dialect_of!(self is SnowflakeDialect) && self.peek_parens_less_nested_join() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to a dialect method that is only set to true for snowflake? e.g. if self.dialect.supports_parens_less_nested_join() && self.peek_parens_less_nested_join()
tests/sqlparser_common.rs
Outdated
@@ -15357,6 +15357,28 @@ fn check_enforced() { | |||
); | |||
} | |||
|
|||
#[test] | |||
fn join_precedence() { | |||
all_dialects_except(|d| d.is::<SnowflakeDialect>()).verified_query_with_canonical( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By switching to the dialect method, we would be able to change these to use all_dialects_where(|d|d.supports_parens_less_nested_join())
Thanks for the review, @iffyio - I've addressed your feedback and it’s ready for another round when you are. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks again @Dimchikkk!
cc @alamb
@@ -278,6 +278,34 @@ pub trait Dialect: Debug + Any { | |||
false | |||
} | |||
|
|||
/// Indicates whether the dialect supports left-associative join parsing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice thanks for the description!
Fixes #1904.
The bug was introduced in #1799.